/**
 * User: zsquirrel
 * Date: 2020/5/1
 * Time: 10:15 上午
 */
package com.cskaoyan.mall.model;

import com.cskaoyan.mall.model.enmu.OrderState;
import com.cskaoyan.mall.model.vo.UserVO;

public class Order {

    private Integer id;

    private Integer userId;

    private Integer goodsId;

    private Integer goodsDetailId;

    private String goods;

    private String spec;

    private Integer goodsNum;

    private Double amount;

    private Integer stateId;

    private String state;

    private String nickname;

    private String name;

    private String address;

    private String phone;

    private String img;

    private Double unitPrice;

    private UserVO user;

    public Integer getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Integer goodsId) {
        this.goodsId = goodsId;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getGoodsDetailId() {
        return goodsDetailId;
    }

    public void setGoodsDetailId(Integer goodsDetailId) {
        this.goodsDetailId = goodsDetailId;
    }

    public String getGoods() {
        return goods;
    }

    public void setGoods(String goods) {
        this.goods = goods;
    }

    public String getSpec() {
        return spec;
    }

    public void setSpec(String spec) {
        this.spec = spec;
    }

    public Integer getGoodsNum() {
        return goodsNum;
    }

    public void setGoodsNum(Integer goodsNum) {
        this.goodsNum = goodsNum;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public Integer getStateId() {
        return stateId;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public Double getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(Double unitPrice) {
        this.unitPrice = unitPrice;
    }

    /**
     * dbutils反射封装数据到order对象的时候，会不会调用该方法？
     * @param stateId
     */
    public void setStateId(Integer stateId) {
        if(stateId.equals(OrderState.UN_PAID.getId())){
            setState(OrderState.UN_PAID.getName());
        }if(stateId.equals(OrderState.UN_SHIPED.getId())){
            setState(OrderState.UN_SHIPED.getName());
        }
        if(stateId.equals(OrderState.SHIPED.getId())){
            setState(OrderState.SHIPED.getName());
        }
        if(stateId.equals(OrderState.RECEIVED.getId())){
            setState(OrderState.RECEIVED.getName());
        }
        this.stateId = stateId;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public UserVO getUser() {
        return user;
    }

    public void setUser(UserVO user) {
        this.user = user;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }
}
